package com.wondream.java.io.example.file;

import cn.hutool.core.io.resource.ClassPathResource;
import org.springframework.util.FileCopyUtils;

import java.nio.charset.StandardCharsets;

/**
 * 使用spring自带的FileCopyUtils
 */
public class FileCopyUtilsTest {
    public static void main(String[] args) throws Exception {
        ClassPathResource classPathResource = new ClassPathResource("application.yml");
        byte[] bytes = FileCopyUtils.copyToByteArray(classPathResource.getStream());
        String content = new String(bytes, StandardCharsets.UTF_8);
        System.out.println("result:" + content);
    }
}
